<?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

/* JoomLeague League Management and Prediction Game for Joomla!
 * @version $Id: show_next_match.tpl.php 1151 2008-06-24 15:07:32Z julienv $
 * @package Joomleague
 * @copyright Copyright (C) 2007  JoomLeague
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see _joomleague_license.txt
 *  
 * Homepage: http://www.joomleague.de
 * Support: htt://www.joomleague.de/forum/
 * 
 * This file is part of JoomLeague.
 *  
 * JoomLeague is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * Please note that the GPL states that any headers in files and
 * Copyright notices as well as credits in headers, source files
 * and output (screens, prints, etc.) can not be removed.
 * You can extend them with your own credits, though...
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 * The "GNU General Public License" (GPL) is available at
 * http://www.gnu.org/copyleft/gpl.html.
*/ 

?>
<div id="joomleague">
<!-- Header with Project Name-->
<?php if ($showNextMatch_config['show_project_heading'] == "1" OR $overall_config['show_project_heading'] == "1") { ?>
<div class="componentheading"<?php if ($showNextMatch_config['show_print_button'] == "1" OR $overall_config['show_print_button'] == "1") echo ' style="float:left;"';?>><?php echo $htmlHelper->showTitle($joomleague, $overall_config['project_heading_type']); ?></div>
<!-- Druckfunktion -->
<?php if ($showNextMatch_config['show_print_button'] == "1" OR $overall_config['show_print_button'] == "1") {
$htmlHelper->PrintIcon( $row, $params, false, '' );
};?>
<!-- Druckfunktion Ende -->
<?php } ?>
<!-- Header END -->

<?php if ($showNextMatch_config['show_section_heading']==1) { ?>
<!-- Bereichs�berschrift z.B Tabelle, Tippabgabe usw. bei Bedarf mit Drucksymbol -->
<table width="100%" class="contentpaneopen">
	<tr>
		<td class="contentheading"><?php echo _JL_PLAYERS_NEXT_MATCH;?></td>
	</tr>
</table>
<!-- Bereichs�berschrift Ende -->
<?php } ?>

<table width="96%" align="center" border="0" cellpadding="3" cellspacing="0">


<?php if($showNextMatch_config['show_logo']==1){?>
    <tr>
      <td width="49%" align="center" valign="middle">
        <?php echo $matchpart_pics[0];?>
      </td>
      <td width="2%">&nbsp;</td>
      <td width="49%" align="center" valign="middle">
        <?php echo $matchpart_pics[1];?>
      </td>
    </tr>
<?php } ?>
    <tr>
      <td width="49%" align="center"><?php echo $teams[0]->name;?></td>
      <td width="2%"><?php echo ($show_pics)? '&nbsp;' : '<b>vs.</b>';?></td>
      <td width="49%" align="center"><?php echo $teams[1]->name;?></td>
    </tr>
    <tr>
      <td colspan="3" align="center">
        <br /><?php echo "";?>
      </td>
    </tr>
</table>

<table width="96%" align="center" border="0" cellpadding="3" cellspacing="0">
<?php if ($showNextMatch_config['show_match_count']==1) { ?>
  <tr class="sectiontableheader" align="center">
    <td colspan="3" class="sectiontableheader"><?php echo _JL_PLAYERS_NEXT_MATCH_COUNT_MATCHES;?></td>
  </tr>
  <tr class="sectiontableentry2">
    <td align="center"><?php echo $homeRanked->cnt_matches;?></td>
    <td align="center">&nbsp;</td>
    <td align="center"><?php echo $awayRanked->cnt_matches;?></td>
  </tr>
<?php } ?>
<?php if ($showNextMatch_config['show_match_total']==1) { ?>  
  <tr class="sectiontableheader" align="center">
    <td colspan="3" class="sectiontableheader"><?php echo _JL_PLAYERS_NEXT_MATCH_TOTAL;?></td>
  </tr>
  <tr class="sectiontableentry2">
    <td align="center"><?php printf("%s/%s/%s",$homeRanked->cnt_won, $homeRanked->cnt_draw, $homeRanked->cnt_lost);?></td>
    <td align="center">&nbsp;</td>
    <td align="center"><?php printf("%s/%s/%s",$awayRanked->cnt_won, $awayRanked->cnt_draw, $awayRanked->cnt_lost);?></td>
  </tr>
<?php } ?>  
<?php if ($showNextMatch_config['show_match_total_home']==1) { ?>  
  <tr class="sectiontableheader" align="center">
    <td colspan="3" class="sectiontableheader"><?php echo _JL_PLAYERS_NEXT_MATCH_HOME;?></td>
  </tr>
  <tr class="sectiontableentry2">
    <td align="center"><?php printf("%s/%s/%s",$homeRanked->cnt_won_home, $homeRanked->cnt_draw_home, $homeRanked->cnt_lost_home);?></td>
    <td align="center">&nbsp;</td>
    <td align="center"><?php printf("%s/%s/%s",$awayRanked->cnt_won_home, $awayRanked->cnt_draw_home, $awayRanked->cnt_lost_home);?></td>
  </tr>
<?php } ?>  
<?php if ($showNextMatch_config['show_match_total_away']==1) { ?>  
  <tr class="sectiontableheader" align="center">
    <td colspan="3" class="sectiontableheader"><?php echo _JL_PLAYERS_NEXT_MATCH_AWAY;?></td>
  </tr>
  <tr class="sectiontableentry2">
    <td align="center"><?php printf("%s/%s/%s",$homeRanked->cnt_won-$homeRanked->cnt_won_home, $homeRanked->cnt_draw-$homeRanked->cnt_draw_home, $homeRanked->cnt_lost-$homeRanked->cnt_lost_home);?></td>
    <td align="center">&nbsp;</td>
    <td align="center"><?php printf("%s/%s/%s",$awayRanked->cnt_won-$awayRanked->cnt_won_home, $awayRanked->cnt_draw-$awayRanked->cnt_draw_home, $awayRanked->cnt_lost-$awayRanked->cnt_lost_home);?></td>
  </tr>
<?php } ?>  
<?php if ($showNextMatch_config['show_match_points']==1) { ?>    
  <tr class="sectiontableheader" align="center">
    <td colspan="3" class="sectiontableheader"><?php echo _JL_PLAYERS_NEXT_MATCH_POINTS;?></td>
  </tr>
  <tr class="sectiontableentry2">
    <td align="center"><?php echo $homeRanked->sum_points;?></td>
    <td align="center">&nbsp;</td>
    <td align="center"><?php echo $awayRanked->sum_points;?></td>
  </tr>
<?php } ?>  
<?php if ($showNextMatch_config['show_match_goals']==1) { ?>    
  <tr class="sectiontableheader" align="center">
    <td colspan="3" class="sectiontableheader"><?php echo _JL_PLAYERS_NEXT_MATCH_GOALS;?></td>
  </tr>
  <tr class="sectiontableentry2">
    <td align="center"><?php printf("%s : %s", $homeRanked->sum_matchpart1_result, $homeRanked->sum_matchpart2_result);?></td>
    <td align="center">&nbsp;</td>
    <td align="center"><?php printf("%s : %s", $awayRanked->sum_matchpart1_result, $awayRanked->sum_matchpart2_result);?></td>
  </tr>
<?php } ?>  
<?php if ($showNextMatch_config['show_match_diff']==1) { ?>    
  <tr class="sectiontableheader" align="center">
    <td colspan="3" class="sectiontableheader"><?php echo _JL_PLAYERS_NEXT_MATCH_DIFFERENCE;?></td>
  </tr>
  <tr class="sectiontableentry2">
    <td align="center"><?php echo $homeRanked->sum_matchpart1_result - $homeRanked->sum_matchpart2_result;?></td>
    <td align="center">&nbsp;</td>
    <td align="center"><?php echo $awayRanked->sum_matchpart1_result - $awayRanked->sum_matchpart2_result;?></td>
  </tr>
<?php } ?>  
<?php if ($showNextMatch_config['show_match_highest_stats']==1) { 
	
  $stat = $home_highest_home_win; 
  $hhs[] = ($homeRanked->cnt_won_home > 0)? sprintf("%s - %s %s:%s", $stat->hometeam, $stat->awayteam, $stat->homegoals, $stat->awaygoals) : "---";
  $stat = $away_highest_home_win; 
  $hhs[] = ($awayRanked->cnt_won_home > 0)? sprintf("%s - %s %s:%s", $stat->hometeam, $stat->awayteam, $stat->homegoals, $stat->awaygoals) : "---";
  
  $stat = $home_highest_home_def;
  $hhl[] = ($homeRanked->cnt_lost_home > 0)? sprintf("%s - %s %s:%s", $stat->hometeam, $stat->awayteam, $stat->homegoals, $stat->awaygoals) : "---";
  $stat = $away_highest_home_def; 
  $hhl[] = ($awayRanked->cnt_lost_home > 0)? sprintf("%s - %s %s:%s", $stat->hometeam, $stat->awayteam, $stat->homegoals, $stat->awaygoals) : "---";
  
  $stat = $home_highest_away_win; 
  $has[] = ($homeRanked->cnt_won-$homeRanked->cnt_won_home > 0)? sprintf("%s - %s %s:%s", $stat->hometeam, $stat->awayteam, $stat->homegoals, $stat->awaygoals) : "---";
  $stat = $away_highest_away_win; 
  $has[] = ($awayRanked->cnt_won-$awayRanked->cnt_won_home > 0)? sprintf("%s - %s %s:%s", $stat->hometeam, $stat->awayteam, $stat->homegoals, $stat->awaygoals) : "---";
  
  $stat = $home_highest_away_def; 
  $hal[] = ($homeRanked->cnt_lost-$homeRanked->cnt_lost_home > 0)? sprintf("%s - %s %s:%s", $stat->hometeam, $stat->awayteam, $stat->homegoals, $stat->awaygoals) : "---";
  $stat = $away_highest_away_def; 
  $hal[] = ($awayRanked->cnt_lost-$awayRanked->cnt_lost_home > 0)? sprintf("%s - %s %s:%s", $stat->hometeam, $stat->awayteam, $stat->homegoals, $stat->awaygoals) : "---";

  if ($showNextMatch_config['show_match_highest_won']==1) { ?>
  <tr class="sectiontableheader" align="center">
    <td colspan="3" class="sectiontableheader"><?php echo _JL_PLAYERS_NEXT_MATCH_HIGHEST_WON_HOME;?></td>
  </tr>
  <tr class="sectiontableentry2">
    <td align="center"><?php echo $hhs[0];?></td>
    <td align="center">&nbsp;</td>
    <td align="center"><?php echo $hhs[1]?></td>
  </tr>
<?php } ?>
<?php if ($showNextMatch_config['show_match_highest_loss']==1) { ?>    
  <tr class="sectiontableheader" align="center">
    <td colspan="3" class="sectiontableheader"><?php echo _JL_PLAYERS_NEXT_MATCH_HIGHEST_LOSS_HOME;?></td>
  </tr>
  <tr class="sectiontableentry2">
    <td align="center"><?php echo $hhl[0];?></td>
    <td align="center">&nbsp;</td>
    <td align="center"><?php echo $hhl[1];?></td>
  </tr>
<?php } ?>  
<?php if ($showNextMatch_config['show_match_highest_won_away']==1) { ?>    
  <tr class="sectiontableheader" align="center">
    <td colspan="3" class="sectiontableheader"><?php echo _JL_PLAYERS_NEXT_MATCH_HIGHEST_WON_AWAY;?></td>
  </tr>
  <tr class="sectiontableentry2">
    <td align="center"><?php echo $has[0];?></td>
    <td align="center">&nbsp;</td>
    <td align="center"><?php echo $has[1]?></td>
  </tr>
<?php } ?>  
<?php if ($showNextMatch_config['show_match_highest_loss_away']==1) { ?>    
  <tr class="sectiontableheader">
    <td colspan="3" class="sectiontableheader" align="center"><?php echo _JL_PLAYERS_NEXT_MATCH_HIGHEST_LOSS_AWAY;?></td>
  </tr>
  <tr class="sectiontableentry2">
    <td align="center"><?php echo $hal[0];?></td>
    <td align="center">&nbsp;</td>
    <td align="center"><?php echo $hal[1]?></td>
  </tr>
  <?php } ?> 
<?php } ?>  
</table>
<!-- Inhalt Ende -->

<!-- Print Button START -->
<?php if ($showNextMatch_config['show_back_button'] > 0 OR $overall_config['show_back_button'] > 0) {;?>
<?php if ($showNextMatch_config['show_back_button'] == "1" OR $overall_config['show_back_button'] == "1") echo '<div align="left">'; else echo '<div align="right">';?>
<?php
$params = & new mosParameters( '' );
$params->def( 'back_button', true );
$params->def( 'popup', false );
mosHTML::BackButton( $params );
  echo "</div>";
};?>
<!-- Print Button END -->
</div>